package cn.com.dealme.error;

import java.util.HashMap;
import java.util.Map;

import cn.com.dealme.Keys;

public class ErrorMap<K, V> extends HashMap<K, V> {
	
	public static final String ERR_MAP_KEY = "_errMap";

	private static final long serialVersionUID = -8856869695775420171L;
	
	public ErrorMap() {
		
	}
	
	public static Map<String, String> makeErrMap() {
		Map<String, String> map = new HashMap<String, String>();
		map.put(Keys.Success, Boolean.FALSE.toString());
		return map;
	}

	@SuppressWarnings("unchecked")
	@Override
	public V put(K key, V value) {
		if(this.containsKey(key)) {
			return super.put(key, (V) (this.get(key) + "," + value));
		} else {
			return super.put(key, value);
		}
	}
	
}
